Chemview can render multiple widgets and sync between their controls


In [13]:
from chemview import MolecularViewer
from chemview import enable_notebook
enable_notebook()

import numpy as np



In [15]:
from IPython.display import display
from IPython.utils.traitlets import link
from IPython.html.widgets import ContainerWidget
# Drawing a water molecule
mvs = []

for i in range(3):
    mv = MolecularViewer(np.array([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]]),
                         {'atom_types': ['Na', 'O', 'Cl'],
                          'bonds': [[0, 1], [1, 2]]},
                         width = 300,
                         height = 300)
    mv.static_moving = True
    mv.points()
    mv.lines()
    mvs.append(mv)
    #display(mv)
    
link(*[(mv, "camera_str") for mv in mvs])

container = ContainerWidget()
container.children = mvs

display(container)
container.remove_class('vbox')
container.add_class('hbox')

In [ ]: